using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;

namespace Lib
{
    public class EncodingTranslator : IDataTranslator
    {
        private readonly Encoding _sourceEncoding;

        public EncodingTranslator() : this(new UTF8Encoding()) {}
        public EncodingTranslator(Encoding sourceEncoding)
        {
            _sourceEncoding = sourceEncoding;
        }

        string IDataTranslator.Translate(IEnumerable<byte> bytes)
        {
            return _sourceEncoding.GetString(bytes.ToArray());
        }
    }
}